import sys
sys.path.append("C:\\Panda3D-1.7.2\\")
from direct.showbase.DirectObject import DirectObject
from direct.task import Task
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *

class Pig(DirectObject):
    def __init__(self):
        
        #self.node = NodePath('physicsNode')
        self.node.reparentTo(render)
        self.pigNode = ActorNode('pig')
        self.pigNodePath = self.node.attachNewNode(self.pigNode)       
        self.pig = self.loadObject(loader.loadTexture("../media/pig.png"))
        self.pig.reparentTo(self.pigNodePath)

        self.pigNodePath.setScale(1)
        self.pigNodePath.setPos(-3,10,-1.7)


    def setPhysics(self):
        #self.pigNode.getPhysicsObject().setMass(6)
        #base.physicsMgr.attachPhysicalNode(self.pigNode)
        pass
    
    def setCollision(self,traverser):
        #self.ColSphere = CollisionSphere(0,0,0,.5)
        #self.ColSphereNodePath = self.pig.attachNewNode(CollisionNode('PigSphere'))
        #self.ColSphereNodePath.node().addSolid(self.ColSphere)
        #self.ColSphereNodePath.show()

        #base.physics.addCollider(self.ColSphereNodePath, self.pigNodePath)
        #base.cTrav.addCollider(self.ColSphereNodePath, base.physics)
        pass
    def loadObject(self, textureobj):
        obj = loader.loadModel("../media/plane")
        obj.reparentTo(render)
        obj.setBin("unsorted", 0)
        obj.setDepthTest(False)

        obj.setTransparency(1)
        obj.setTexture(textureobj, 1)
        return obj
